package com.msb.api.util;

import com.msb.api.vo.ResultVo;
import com.msb.common.exception.ApiException;

/**
 * @Author: lmf
 * @Create: 2025/3/7 10:12
 * Description:
 */
public class R {
    public static ResultVo ok() {
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(0);
        resultVo.setMsg("接收成功");
        return resultVo;
    }

    public static ResultVo error(Integer code, String message) {
        ResultVo resultVo = new ResultVo();
        resultVo.setCode(code);
        resultVo.setMsg(message);
        return resultVo;
    }

    public static ResultVo error(ApiException e) {
        final ResultVo resultVo = new ResultVo();
        resultVo.setCode(e.getCode());
        resultVo.setMsg(e.getMessage());
        return resultVo;
    }
}
